package com.wyt.cloud.utils.query.duty;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wyt.cloud.utils.bean.BeanUtil;
import com.wyt.cloud.utils.query.FilterMatchRuleEnum;
import com.wyt.cloud.utils.query.reqvo.OrderByParams;
import lombok.Data;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Data
public class QueryTask<S, T> {

    public static final String sortFields = BeanUtil.getBeanFieldName(OrderByParams::getSortFields);
    public static final List<FilterMatchRuleEnum> nullAboutList = Arrays.stream(FilterMatchRuleEnum.values())
            .filter(x -> FilterMatchRuleEnum.IS_NULL.equals(x) || FilterMatchRuleEnum.NOT_NULL.equals(x))
            .collect(Collectors.toList());

    /**
     * 入参对象
     */
    private S entity;
    /**
     * pojo类
     */
    private Class<T> tClass;
    /**
     * 查询条件构造器
     */
    private QueryWrapper<T> wrapper;


}
